from .base import PermissionHandler
from stark.service.v1 import StarkConfig, StarkModelForm
from stark.service.v1 import get_choice_text, get_image_text
from stark.service.upload import UploadConfig
from django.conf.urls import url
from django.shortcuts import render, get_object_or_404, HttpResponse
from django.utils.safestring import mark_safe

from house.models import House


class HouseConfig(PermissionHandler, StarkConfig):
    # 启用图片功能
    has_image_field = True
    # 指定当前表的图片字段名（必须与Model中的ImageField名一致）
    image_field_name = "cover_image"
    # 列表页显示的列（需包含图片字段对应的display_image函数，已在get_list_display中自动添加）

    list_display = ["id", "room_number", "landlord_id", "city_area_id", "address", "house_type", "area_size", "rent_price", "deposit", "facilities", get_choice_text("状态", "status"), "description", get_image_text("图片", "cover_image")]
    